﻿using BusinessLogicLayer;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PresentationLayer
{
    public delegate void LoadList(List<HoSoUngVien> HoSoUV);
    public partial class TimKiemHoSoForm : Form
    {
        public TimKiemHoSoForm()
        {
            InitializeComponent();
            this.cbbTrangThai.SelectedIndex = 0;
        }
        public LoadList MySearchList { get; set; }
        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            string trThai;
            if (cbbTrangThai.SelectedIndex == 0)
                trThai = "";
            else trThai = cbbTrangThai.Text;
            var ar = new HoSoUngVienManager().TimTheoTieuChi(txtTDHV.Text, txtVTMongMuon.Text, txtKNNN.Text, txtKNCM.Text, txtTenUV.Text, trThai);
            if (ar.Success)
                MySearchList(ar.ObjectList);
            else MessageBox.Show("Xảy ra lỗi!\n\nChi tiết: " + ar.Exceptions[ar.Exceptions.Count - 1].Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }


    }
}
